; Englisches Install-Script fr Diavolo-Backup
;
;  1993/1994 Martin Korndrfer
;
; $VER:DiavoloFileInstall_english 1.26 (06-Oct-94)
;
; Version 1.26
; - Added 68040.library and SetPatch
;
; Version 1.22
;
;   Initial Release

(set @abort-button "Cancel Installation")

(set @app-name "Diavolo Backup 1.26")

(set @language "english")

(welcome "Welcome to the installation of DiavoloBackup 1.22!")

(set Ok 0)

(complete 0)

(set savedest @default-dest)

(set ToDo (askoptions (prompt "Please choose the desired operation:")
                      (help (cat "The option 'Install to Harddisk' copies \
Diavolo Backup to your harddrive and installs the required tools and \
files.\nYou *MUST* install Diavolo, even if it's already copied to your harddisk!\n\n\
'Create / update emergency boot disk' creates or updates a bootable disk which can be \
used to start Diavolo in the case you don't have access to your harddisk \
anymore.\nIf the configuration of Diavolo Backup has changed, you should update \
the emergency disk.\n\n" @askoptions-help))
                      (choices "Install Diavolo Backup"
                               "Create / update emergency boot disk")
                      (default $3))
)


(if (= ToDo $2)
    ((if (<> (askbool (prompt ("Diavolo must already have been installed to create a emergency disk.\nAre you sure that you want to create the emergency disk without installing Diavolo first?"))
                      (help @askbool-help)
                      (choices "Create disk w/o install" "Install Diavolo first")
                      (default 1))
             1)
       (set ToDo $3))
    )
)

(if (<> (BITAND ToDo $1) 0)
    ((set newdest (askdir (prompt "Please specify the directory Diavolo shall be installed to.")
                          (help (cat "Specify the exact directory path for \
Diavolo Backup, for instance 'Work:Diavolo'. The directory does not exist, \
it will be created automatically.\n\n" @askdir-help))
                          (default (tackon savedest "Diavolo"))
                          (newpath))
     )

     (set @default-dest newdest)

     (complete 5)

     (copyfiles (prompt "Copying Diavolo Backup...")
                (source "")
                (dest @default-dest)
                (pattern "(Diavolo|Diavolo_Guide|#?.prefs)")
                (infos))

     (if (= (exists (tackon @default-dest "Tape Catalogs") (noreq)) 0)
         (makedir (tackon @default-dest "Tape Catalogs") (prompt ("Creating directory 'Tape Catalogs'!" newdest))
                          (infos))
     )

     (complete 10)

     (copyfiles (prompt "Copying Fonts...")
                (source "fonts")
                (dest (tackon @default-dest "fonts"))
                (fonts)
                (all))

     (complete 15)

     (copyfiles (prompt "Copying locale files...")
                (source "catalogs")
                (dest (tackon @default-dest "catalogs"))
                (all))

     (complete 18)

     (if (<> (exists "locale:catalogs/deutsch" (noreq)) 0)
         (copyfiles (prompt "Copying locale files...")
                (source "catalogs")
                (dest "locale:catalogs")
                (all))
     )

     (complete 20)

     (copylib (prompt "Installing XPKmaster.library...")
              (help @copylib-help)
              (source "libs/xpkmaster.library")
              (dest "libs:")
              (optional nofail askuser))

     (complete 25)

     (foreach "libs/compressors" "xpk#?.library"
      (copylib (prompt ("Installing %s" @each-name))
               (help @copylib-help)
               (source (tackon "libs/compressors" @each-name))
               (dest "libs:compressors")
               (optional nofail askuser))
     )

     (complete 50)

     (copylib (prompt "Installing asl.library...")
              (help @copylib-help)
              (source "libs/asl.library")
              (dest "sys:libs")
              (confirm)
              (optional nofial askuser))

     (complete 54)

     (copylib (prompt "Installing diskfont.library...")
              (help @copylib-help)
              (source "libs/diskfont.library")
              (dest "sys:libs")
              (confirm)
              (optional nofial askuser))

     (complete 56)

     (copylib (prompt "Installing locale.library...")
              (help @copylib-help)
              (source "libs/locale.library")
              (dest "sys:libs")
              (confirm)
              (optional nofial askuser))

     (complete 58)

     (copylib (prompt "Installing iffparse.library...")
              (help @copylib-help)
              (source "libs/iffparse.library")
              (dest "sys:libs")
              (confirm)
              (optional nofial askuser))

     (complete 60)

     )
)

(if (<> (BITAND ToDo $2) 0)
    (
        (set Result 1)
        (until (= Result 0)
               (if (<> (askbool (prompt ("Please insert a Disk into drive DF0:. This Disk will be formatted!"))
                        (help (cat "If you don't want to format a disk, press 'Cancel'.\n\n" @askbool-help))
                        (choices "Continue" "Cancel")
                        (default 1)) 1)
                   (exit))
               (working "Formatting disk...\n\nPlease wait!")
               (set Result (run "sys:system/format < nil: drive df0: name \"DiavoloEmergencyDisk\" ffs noicons"))
               (if (= Result 0)
                   (set Result (run "sys:c/install df0:"))
               )
        )

        (complete 65)

        (copyfiles (prompt "Copying Diavolo Backup...")
                   (source "")
                   (dest "df0:")
                   (pattern "(Diavolo|Diavolo_Guide|#?.prefs)")
                   (infos))

        (complete 67)

        (copyfiles (prompt "Copying c:Assign ...")
                   (source "c:assign")
                   (dest "df0:c")
                   (optional nofail))

        (copyfiles (prompt "Copying c:SetPatch...")
                   (source "c:SetPatch")
                   (dest "df0:c")
                   (optional nofail))

        (complete 69)

        (copyfiles (prompt "Copying libraries ...")
                   (source "sys:libs")
                   (dest "df0:libs")
                   (pattern "(asl.library|diskfont.library|iffparse.library|locale.library|68040.library)")
                   (optional nofail))

        (complete 75)

        (copyfiles (prompt "Copying XPK Master library ...")
                   (source "libs:xpkmaster.library")
                   (dest "df0:libs")
                   (optional nofail))

        (complete 77)

        (copyfiles (prompt "Copying XPK libraries ...")
                   (source "libs:compressors")
                   (dest "df0:libs/compressors")
                   (pattern "(xpkFAST.library|xpkFEAL.library|xpkNUKE.library|xpkBLZW.library|xpkRDCN.library)")
                   (optional nofail))

        (complete 85)

        (copyfiles (prompt "Copying locale files...")
                   (source "catalogs")
                   (dest "df0:catalogs")
                   (all))

        (complete 87)

        (copyfiles (prompt "Copying Fonts...")
                   (source "fonts")
                   (dest "df0:fonts")
                   (fonts)
                   (all))

        (complete 95)

        (makedir "df0:s"
                 (prompt "Creating directory s ..." ))

        (complete 97)

        (textfile (prompt "Creating df0:s/startup-sequence")
                  (dest "df0:s/startup-sequence")
                  (append "SetPatch > nil\necho \"*n*nLoading *e[1mDiavolo Backup*e[0m. Please wait...\"\nassign env: ram:\nDiavolo\n"))
    )
)

(complete 100)

(exit)

